﻿using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Zws.Frameworker.Module;

namespace Zws.Redis
{
    public class ZwsRedisModule : ModuleMark
    {
        public void OnBuilderExec(WebApplicationBuilder builder)
        {

            builder.Services.AddSingleton(typeof(RedisClient), new RedisClient(new RedisConfig
            {
                Ip = builder.Configuration["Redis:Ip"],
                Password = builder.Configuration["Redis:Password"],
                Port = builder.Configuration["Redis:Port"],
                Db = Convert.ToInt32(builder.Configuration["Redis:Db"]),
            }));
        }
    }
}
